const modalPlugin = requirePlugin('lightPlugin');
Component({
  props: {
    onAdInstance: () => {},
		onAdLoad: () => {},
		onAdError:()=>{}
		 
  },
  data: {
		interstitialAd: {}
  },
  onInit() {
	  console.log(111)
	const ad = new modalPlugin.CreateInterstitialAd();
	this.props.onAdInstance && this.props.onAdInstance(ad);
	this.setData({
		interstitialAd: ad
	})
	
	this.data.interstitialAd.onLoad(() => {
		console.log('ad onLoad')
		console.log(this.data.interstitialAd, 'ad')
		this.props.onAdLoad()
	})
	
	this.data.interstitialAd.onClose((isClick) => {
	  console.log('close', isClick);
	});

	this.data.interstitialAd.onError((err) => {
	  console.log('error', err);
	  this.props.onAdError(err)
	 
	});
  },
  methods: {
 
  },
});
